<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@include file="common/header.jsp"%>
		<div class="center">
			<div class="col-main">
				<div class="main-wrap" style="background-color:white;">

					<div class="am-cf am-padding">
						<div class="am-fl am-cf"><strong class="am-text-danger am-text-lg">修改密码</strong> / <small>Password</small></div>
					</div>
					<hr/>
					<!--进度条-->
					<div class="m-progress">
						<div class="m-progress-list">
							<span class="step-1 step">
                                <em class="u-progress-stage-bg"></em>
                                <i class="u-stage-icon-inner">1<em class="bg"></em></i>
                                <p class="stage-name">重置密码</p>
                            </span>
							<span class="step-2 step">
                                <em class="u-progress-stage-bg"></em>
                                <i class="u-stage-icon-inner">2<em class="bg"></em></i>
                                <p class="stage-name">完成</p>
                            </span>
							<span class="u-progress-placeholder"></span>
						</div>
						<div class="u-progress-bar total-steps-2">
							<div class="u-progress-bar-inner"></div>
						</div>
					</div>
					<form class="am-form am-form-horizontal" action="${pageContext.request.contextPath }/user/password" id="form">
						<input type="hidden" name="userCode" value="${userSession.userCode}" id="userCode"/>
						<div class="am-form-group">
							<label for="user-old-password" class="am-form-label">原密码</label>
							<div class="am-form-content">
								<input type="password" id="user-old-password" placeholder="请输入原登录密码" name="oldPassword">
							</div>
							<span id="show" style="color:red;" value=""></span>
						</div>
						<div class="am-form-group">
							<label for="user-new-password" class="am-form-label">新密码</label>
							<div class="am-form-content">
								<input type="password" id="user-new-password" placeholder="由数字、字母组合" name="newPassword">
							</div>
							<span id="newshow" style="color:red;" value="1"></span>
						</div>
						<div class="am-form-group">
							<label for="user-confirm-password" class="am-form-label">确认密码</label>
							<div class="am-form-content">
								<input type="password" id="user-confirm-password" placeholder="请再次输入上面的密码" name="newPassword1">
							</div>
							<span id="confirmshow" style="color:red;" value="1"></span>
						</div>
						<div class="info-btn">
							<button type="submit" class="am-btn am-btn-danger" id="sumbit">保存修改</button>
						</div>

					</form>

				</div>
				</div>
<%@include file="common/footer.jsp"%>
</div>

  </body>
 <script>
	$(function(){
		
		$("#user-old-password").on("blur",function(){
			var _userCode = $("#userCode").val();
			var _password = $(this).val();
			$("#span").val("");
			$.ajax({
				url : "/Trip/user/judge",
				data : {password : _password,userCode:_userCode},
				dataType : "json",
				type : "POST",
				success : function(data){
					if(data == "success"){
						$("#show").html("");
						$("#show").val("1");
					}else{
						$("#show").html("旧密码不匹配!!!");
					}
				}
			
			});
		
		});
		
		$("#user-new-password").on("blur",function(){
			var newPaw = $("#user-new-password").val();
			if(newPaw.length != 6){
				$("#newshow").html("密码必须为6位数字");
				$("#newshow").val("");
			}else{
				$("#newshow").html("");
				$("#newshow").val("1");
			}
		});
		
		$("#user-confirm-password").on("blur",function(){
			var newPaw = $("#user-new-password").val();
			var newPaw1 = $("#user-confirm-password").val();
			if(!(newPaw==newPaw1)){
				$("#confirmshow").html("两次密码不匹配!");
				$("#confirmshow").val("");
			}else{
				$("#confirmshow").html("");
				$("#confirmshow").val("1");
			}
		});
		
		$("#submit").on("click",function(){
			var show = $("#show").val();
			var newshow = $("#newshow").val();
			var confirmshow = $("#confirmshow").val();
			if(show != "" && newshow != "" && confirmshow != ""){
				$("#form").submit();
			}else{
				return false;
			}
		
		});
		
		
	});
</script>
</html>
